<template>
  <div class="singer" v-if="singerList">
    <template v-for="item in singerList">
      <div class="singerBox" :key="item.id">
        <div class="imgBox">
          <img :src="item.img1v1Url" />
        </div>
        <p>{{item.name}}</p>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  components: {},
  props: ["singerName"],
  data() {
    return {
      singerList: ""
    };
  },
  watch: {
    singerName: function() {
      this.$http("/search", {
        params: {
          keywords: this.singerName,
          type: 100
        }
      }).then(res => {
        console.log(res);
        this.singerList = res.data.result.artists;
      });
    }
  },
  computed: {},
  methods: {},
  created() {
    this.$http("/search", {
      params: {
        keywords: this.singerName,
        type: 100
      }
    }).then(res => {
      console.log(res);
      this.singerList = res.data.result.artists;
    });
  },
  mounted() {
    console.log(this.singerList);
  }
};
</script>
<style lang="scss" scoped>
@import "~@/assets/css/common.scss";
.singer {
  padding: vw(10);
  .singerBox {
    width: 100%;
    display: flex;
    align-items: center;
    padding: vw(5) 0;
    .imgBox {
      width: vw(40);
      height: vw(40);
      overflow: hidden;
      border-radius: 50%;
      img {
        width: 100%;
      }
    }
    p {
      font-size: vw(16);
      padding-left: vw(10);
    }
  }
}
</style>